/**
 * 作者: wgx
 * 日期: 2024-11-20 15:21:28
 * 备注: 用户兽潮来袭模块信息表
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.server.game.base.AllParam;
import com.motu.monstercity.server.game.base.ProtoDataUtils;
import com.motu.monstercity.server.game.commondata.fight.MonsterTideMain;
import com.motu.monstercity.server.game.logic.FightManager;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import io.vertx.core.json.JsonObject;

public class UserMonsterTideInfo extends UserMonsterTideInfoModel {
    public UserMonsterTideInfo() {
        super();
    }

    public JsonObject insert() {
        int monsterTideId = 1;
        putNextMonsterTideId(monsterTideId);
        MonsterTideMain monsterTideMain = FightManager.getMonsterTideMain(monsterTideId);
        putNextTime(TimeUtils.getCurTime() + monsterTideMain.getDelayTimeSucc());
        putMinTime(TimeUtils.getCurTime() + monsterTideMain.getDelayTimeSucc());
        return super.insert();
    }


    // 上一场战斗是否胜利
    public boolean isLastSucc() {
        return getLastResult() == 1;
    }

    public void reset() {
        long curTime = TimeUtils.getCurTime();
        if (getNextMonsterTideId() > 0 && getNextTime() > 0) {
            if (getNextTime() - curTime < AllParam.MONSTER_TIDE_DATA_TIME) {
                putNextTime(curTime + AllParam.MONSTER_TIDE_DATA_TIME);// 给个保底时间
                update();
            }
        }
    }
}
